
#include "threadid.h"
#include <QString>

namespace Wishmaster
{
	ThreadId::ThreadId() : m_threadId(0), m_valid(false)
	{

	}

	ThreadId::ThreadId(const QString& chanName, const QString& boardId, unsigned int threadId) :
			m_chanName(chanName),
			m_boardId(boardId),
			m_threadId(threadId),
			m_valid(true)
	{
	}

	QString ThreadId::chanName() const
	{
		return m_chanName;
	}

	QString ThreadId::boardId() const
	{
		return m_boardId;
	}

	unsigned int ThreadId::threadNumericId() const
	{
		return m_threadId;
	}

	QString ThreadId::threadStringId() const
	{
		return QString::number(m_threadId);
	}

	bool ThreadId::isValid() const
	{
		return m_valid;
	}

	bool ThreadId::operator<(const ThreadId& id) const
	{
		// FIXME make correct comparison
		return (chanName() < id.chanName()) ||
					(boardId() < id.boardId()) ||
					(threadNumericId() < id.threadNumericId());
	}

	bool ThreadId::operator==(const ThreadId& id) const
	{
		return (chanName() == id.chanName()) && (boardId() == id.boardId()) && (threadNumericId() == id.threadNumericId());
	}

	bool ThreadId::operator!=(const ThreadId& id) const
	{
		return !(*this == id);
	}

} // namespace Wishmaster
